/*
 * Copyright (c) 2006, 2022, webrx.cn All rights reserved.
 *
 */
package cn.webrx;

import java.util.Arrays;
import java.util.Random;

/**
 * <p>Project: jse2204 - Arr3
 * <p>Powered by webrx On 2022-09-06 11:29:17
 * <p>程序功能：声明一个10个元素的数组，并赋值（1-100）随机数，排序前输出，进行排序，排序后再次输出</p>
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Arr3 {
    public static void main(String[] args) {
        //int[] nums = new int[10];
        //int 基本类型 Integer是对象类型是int的包装类
        //int a = 10;
        //Integer b = 10;
        //System.out.println(a);
        //System.out.println(b);
        Integer[] nums = new Integer[10];
        Random rand = new Random();
        for (int i = 0; i < nums.length; i++) {
            nums[i] = rand.nextInt(1, 101);
        }
        System.out.println("排序前：" + Arrays.toString(nums));

        //内置排序
        Arrays.sort(nums);//升序
        System.out.println("排升序后：" + Arrays.toString(nums));
        Arrays.sort(nums, (a, b) -> b - a);//降序
        System.out.println("排降序后：" + Arrays.toString(nums));

    }
}
